Re-wrote get_params() function.