reimagined with lxml and 10% functionality