A working version of the dependency code