dependencies.js rewrite

I rewrote dependencies.js, to be faster with less code.