esc button fix

fixing for future implementations
correction of function usage
variable name change to be consistent