Added exclusion of non-closed beans, but still working on iteration