Cleaned up code and commented, also adjusted the timer interrupt frequency