added better argument parsing