Refactor duplicated code and check for invalid symbol table size.