Generalized bit_stream to use polymorphism