Return and esc button handling