Improved missingChar function