MOve script to main from index