Implemented selecting tasks from the database.