improved checking for haml, better cleaning