Added function to add dependencies and chain dependencies