Fixed some issues with Lab6task2, is working now. Refactoring done. Removed some unused code.