refactor args parsing a bit