completed main script.