Refactored/cleaned up:-
 * Moved common functions into utils.py
 * Made some helper functions to calculate time differences etc.