context should be passed to getDependencies
Various code cleanup and performance optimizations