begin centralizing of bed write code