begin moving code out of graphutil