moar ebml refactor