Improved keyboard edit functionality