Updated main script