Tidy up files and create utility functions for IE8 compatibility