Implements states and transitions generator