Changed the jquery setInterval method to setTimeout and made the code a little more readable