adds sinatra-contrib
extracts some logic
uses the new subscription model