add explicit logic for calculating alt text