added shape distortion and some minor fixes