Enhancement of return handling from db, ifesle to switch etc