add dependency & generalize em for different tasks.