Added Database class (+ minor fixes)