Optimizations to md converter