extract parser and factory, cleanup concerns