Changed the preoutput filter function to use a proper state machine