markdown refactoring #507