if this is zig zag encoding, the method should be called accordingly