html: have the state functions return the next/current state