code clean up + pause function fix