Added test function rest
Added new implementation of rest function