refactor out all non-framework code to their own modules