General purpose IDL tools written by @jradavenport