Reimplention with general lexer