move parser to lib