Add tests for all rank filters and reformat code