Improvements to running tasks

Including ability to stop tasks and automatic aborts if running too
long.