creation of necessary functions