adds error handler
adds database btn and event