some more restructuring; added helper file
some more restructuring; added helper file