Add constants and escape key check