improved root handler