simplified boundary handling