Improved internal functions