Separated processArgs to use more functions and became less complex