refactor complete. ranking stuff is in rank