reworked program using single global for database connection. does not need the conn object to be passed around anymore