Moved keydown and custom events to reBuild function