refactored code to generate html for portfolio index page