Modified some code. Added profiling flags '-pg' on compilation. Now it is easy to monitor performance