rearrange argument parsing