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

Fixes #14 
Use `current_user` instead here.