modified according to advanced jquery