restructuring of the rest of bgparse