modifies immediatley invoked function to query db
modifies immediatley invoked function to query db