added logic to process HTML content (in progress)