Add connection to database. Add basic support for maintenance safety check. Add (buggy) login support.