Replaced DS state machine by preprocessor version.