before change a lot with respect to boundary handling