State machine refactoring - the beginning

I really don't understand this class :(