Added base line code for Rank, added lots of comments