Added interaction with a Database, done some simple tests, code cleanup & arrangement