Added readmemd. Lots of minor fixes.