Optimize keys add key press time functions