Move decoding to a trait

Allows the enforcement of syntax