DID IT!!!

Time to prove it on paper.

Trick was to use vectors.size() everywhere.