Added profiling code
Removed profilling switch