jscan: replaced the main if/then junk with a case statement