added SnapImage code