improved reloading

now it tracks dependencies, and does a correct deep reload