[TAC-156] algo improvment - max size def - refactoring 2