refactoring: use $.fn.extend