Attempt to make the decoder more generic