complete automation code