Organized the decode_setup function