Reorg the code so that every line is processed with if/elseif and fixed questions bug