cleaned up several of Pivot's logic flaws