minors in the scoping (needs deeper refactorings)