refactoring nested state collections system + some minor fixes