WIP. trying to get the flag transitions to work