Corrected logic for parsing function parameters in the correct order.