Fixing some logic in formatBlock