add YMax and create test that covers the bug of 2 cancys only