Added quit option
Lots of comments and code cleanup
Merge conflict from reset-ing commit earlier