Rather large refactoring
Update dscanner to fix issue with parameters not being visible inside their funciton scopes