Fixed lexer and added unit tests for it