Added trace function. Added more tests and exceptions to library functions. For some reason some of the tests are failing and I have no idea why. Gotta look into that.