Fully automated script and further improvements