Removed profiling flag
Imporved code structure, redesigned for performance