Put all config logic in the task, made it safer to start another instance