Refactored into an actual jQuery plugin.