Separated common functions into separate util file