Clean up tasks.py a bit