optimized enter key code a bit