clean up utility code a bit
clean up utility code a bit