modified demo for 2d space