resting place in refactoring
clean up argument parsing, and add all the necessary runtime and compile boundary checks