Cleanup of utility code