added hooks to render each state