Moved db functions into class

Restructured a lot of code. Should streamline a lot of stuff fairly
significantly. Added small readme for server code.