more stringent ifs on keyboard shortcuts