Changed A03 to conform to spec; Changed A04 to proper implementation of loop optimization.