beginnings of jquery plugin. also refactoring to make more sense