Add example and bug fixes