Adds decoder

Also tidies up existing tests