Refactors task variables to global ones

Simplifies function calls and will ensure same state between different
task panels.