added offset, need to fix math