Refactoring.

Simplified the rank function a little. I got rid of a lot of push'es
and replaced them with cons'es. Not sure it's easier to read but I'm not
sure it's harder either so.