changed database connect method to procedural, rather than object oriented