fixed example code and added preview of result