Refactoring

Added class 'Database' responsible for database connections.