Changed offsets to use orderpairs to clean up code.