Adjusted some values, added logic for root node shift.