I see this function has been used elsewhere (like in views/review.js), it might be good to put it in a common place for all files to use?