fixed some bugs and added pause button