Added head shake detection