restructuring, adding ESC close feature