REF: refactor out the rest module for level-rest