revise Main script