Redoing 'trim parameter' method

* Keeping the parameters to be trimmed in an array and trimming them
after the main loop.
* Changed the 'if' statement to check if param needs trimming using
$.trim() rather than regex