Changed minimum distance decoder, return and use codeword not factor, image testing includes standard decoder