Edited as per OnTime #1351 and #1353
Cleaned up code
Cleaned up code