working version; 6 - todo; refactoring needed;