Automatically grab dependencies in build. Misc robustness.