refactored code a bit. added module for memory/cpu profiler