refactor parsing fns to common lib