Cleaned up quit method

added more functionality, cleaned up quit method. added more javadoc