refactor and debug ranking models