Utilities for cs591.