Move database connection into separate class.