shake detection functionality