Made function automation toggleable