refactored processArgs