Trim finite state machine