modified gesture code