refactoring to jquery style