code refactoring due to jquery new version