convert argument parsing to funciton in it's own library.