update class implementation and example