changed script structure