sep. fucntions to move to util.js