implementations of rank and suit functions