Fix the timing bug and remove debug prints