Base skeleton. The core algorithm is not written yet.
First working version