The refactor is finished.

- tests should be run
- bug fix it it will be needed.