changed function of main