Attach the handlers automatically