Restructured code hierarchy and added support for better time profiling