Implemented timer - working version

Everything "technically" works, but there are many bugs and places for optimization.