Minor refactoring for cloth simulation program.