Improved implementation of CollectDependenciesVisitor
General bugfixes and improvements
Fixed multiline comment skip logic