removed some comments and added quit on close delegate method