Refactor sinatra app
Fix merge conflicts