added the database connections and business logic