General work is finished. Now - debug
Small refactoring