Refactoring of Rack app