reduce complexity in getArguments(...) by outsourcing functionality in internal functions. that way getArguments(...) is much easier to understand for others.
recreate documentation to contain new internal functions