Fixed major bug that calculated ranks incorrectly