20- Added some document write features, aswell as cleaning up code.