Database comunication changes

Pull request of all database related changes.