added dimension checks for level 2 and 3