edits for Mac compatibility, cleanup of script interpreter