cleaned up pgbar code