rewrote parser as an importable library