initial implementation of decode_single