Revert "Fixed some timing issues"

This reverts commit 55e8108624e368c74e8f15d45389e1f334860560.
Revert "Reorganized code to be more modular, some tweaks"

This reverts commit ae0657bc6ca7e5bdcadc74a946f09c328783df90.