Added esc key functionality