Works in OSX; and did minor fixes.