Enabled IE9 support
Refactored the code (outlined document creation)