refactored add and quit