spilt common functions to a seperate file