Clean up task array and implement add task functionality