cleaned up automate script