Tom - adding code to deal with dependencies