Tidied up code after merging IE8 changes in