Further refactoring of code, add resting button