Extract and reuse slack function
Consistently use single quotes in rank lib functions