refactor
refactored into more distinct modules, some profiling funcs