In an effort to solve the time leakage issue, I listed out where all I spent my time and found ways to solve it. Here is a log of changes I made, it may not apply to you directly, but I believe you will find some pointers towards the solution of your problem.