Tiny changes, fix comment, remove unused globals and throw and exception instead...