Added better button handling