split bdlang stuff into separate module