Refactored code to fix some major issues.
Moved the parameter separator as the last parameter.
Added comments.
Refactored the procedure to fix some issues.
Moved the separator parameter as last parameter.