added functionality to drawCorners & made rank no long an object