Simplified the quadrilateral algorithm

- works better
- there is still a little bug...