scoping greatly improved, but loops are broken for the moment