add index, taskmanager and refactor