Sort out dependencies