Back to working state with some changes.

Still single-threaded