revamped scripts and minor code changes