refactored some module stuff as classes