cleaned up shape clipper code