add markdown mode, cleanup