updated by adding pretty code for example2