[cleanup] Cleaned up some of the code

Added new event handler on the overlay to close the modal as well as cleaned up some of the code form jslint