refine exception handling, memory estimates