move debug and prtErr to a tools module