Methods extracted
Logic refactored to a finite automaton
KT-2106 Mixed named and positional arguments should be allowed

#KT-2106 Fixed