Improved internal code