Simplify keyboard layout code