added tests and quit option, cleaned variable names