Refactor code, added jquery