handle left and right keys