updated code to run on Sinatra