added offset and comments