reestruct the script for easily read