removed debug code, and streamlined library handler determination