Refactored code and IE9 or less Compatibility.