Replaced function update_database with self executing anonymous function