converted rewinders from plpgsql to sql, unquoted the function parameters.