Use masking from the Rank class and some changes to relRank handling