added function to mainfile