Fix and refactor methods in database class. Add sites addition with unique code

Fixes #14 
Both methods below are defined at the top level. When you write a modular Sinatra app, put all helper methods into the application class.