Simplified code for determining label offsets