refactor corresponding to cr, exception handling improvements