refactor to not to use lxml