getting the dependencies in order