added MAIN function