Fixed the main script