improvement of algorithm with working on mode 3