almost done with utility function