Implemented get_tasks and cleaned up some code.