begins refactor of key assignment to fix bugs