added the rest function

this could solve the requirements in #81