This patch is an attempt to split the handleArgs method.
It is useful for one of my patches that I'll post in a minute.
The idea of the patch is about to move out the code to a new helper static functions.
(to reduce the handleArgs and to isolate the parts of it's logic)