Rearchitect sinatra

Re-architected the sinatra application to be more modular and be less cluttered.