split Bed writing into its own class, remove debug timings
use gtest from build-common