Amended code with attached scripts