Fixed #287 Refactoring of Rest controller