initial code

TODO: fix bug free rectangle grown too fast, and too wasted, and of
course too slow