remove jQuery dependency, some refactors