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

Fixes #14 
Rename this one as well.