Made tasks self-contained and reusable components

This makes it so that the main caller doesn't have to worry about how to
do tasks. It can just string along multiple tasks, and they'll be
executed in the correct order.