Tidied up latest changes. Added documentation
Made lexer an Object