Refactored to reduce code required.
Fixed bug where curies and base links were being overwritten.
Improved documentation.