Minor edits to ms (mostly based on Matt Might's scripts)