finished utility function.. kinda hopefully