Cleaned up source. Added TickHandler for doing tasks.