moved state to constructor