refactored getworktasks.sh