add unit detection, remove prints