Separate toBitfield function into separate typeclass