Refactor openfmri scripts