begin keyboard rewrite