Refactor tasks

cleaning up the tasks.py a bit. Duplication tends to accumulate there, so it's good to go through and DRY it up a bit every now and then.