Optimizing api, fixed bug when no tasks are shown