Ready for server testing

Fixed many bugs, database interactions.