Refactor rank filters

* Renamed source files for consistent naming
* Replaced numpy arrays with typed memoryviews
* Overall styling and comment improvements