Huge progress! Integrate Cezary's changes and fix many other things!