use local jquery, some code cleanup