Added dependencies support / refactored to use deferreds