major refactoring of the plugin, converted everything into a jquery plugin from (almost) scratch