WIP
Improving the rectangle detection algorithm