code cleanup + Rest util refactors