convert if-else to switch-case
convert more if to &&
more fix
some fixes
jj