fix list of scopes and remove unused code