Move to_param to to_query, also Improve tests