Added state to setRendered function