[WIP] Use lexer 

This method is still relying on all the regex stuff: can we use the lexer here as well?