Added code to time the functions
cleaned up code
cleaned up code