Pulled out bufmode to its own file