Lots of changes

Heaps of changes made to the libraries and examples over the past few weeks.