Refactored redcloth code slightly