Improved scheduled and failed tasks processing. Added testapp