updated state funcitonality to default to #state method if defined on class