keyboard: code cleanup