Added code for rest() method.