refactoring rest module