move argument parsing magic to function wrapper