Copy of the decoder for Ruth's jobs
Organise into a main decode function, stuff for Ruth