Changed timer to start and reset per window and added more comments to all code