refactored fold state to an enum