Refactored JQuery codes.