I did it! The program is able to detect quadrilaterals as it should.
(Except for the long, thin ones.)