Factorize code about offset