Adds functionality to have JSON dependencies

This includes some major restructuring within the code, so sorry for the massive diff.