Updated the main script