added last_rank evaluation and full_test function (and some clean up)