Fixed logic for encounter, and markdown behavior