refactor to separate arg parse from business logic