seperate state helper, fix examples