handling boundaries