Full example and some bug fixes