added offset variable