Improved ID handling