renamed modules, started refactoring functions for re-use