Removed unused code and debug printing messages. Added time counter in the callback function