clean up / refactor utility method