added function to main file