Moved resting algorithm to its own method.
Moved resting algorithm to Level class.