A complete re-write of the original plugin by Caitlin Woodward.