Initial commit: refactoring scripts from OpenSurfaces