Added tests and cleaned up examples