refactor md