Background task error

Functioning was using a variable set by a background task to determine
to run or not, which resulted in the variable not being turned off/on
before the function was called. Switched so background task calls the
funciton instead if it succeeds.