refactor command argument parsing