moved decoder in to its own class