improves paneling code. mix of math and looking at the pixels from the mask
Merge remote-tracking branch 'upstream/master'