Restored all the tests and examples, fixed some issues