Code up main script