Beautified demo-2d code