Corrected offset calculation: it must be taken in absolute value.