jquery added, some changes and refactors