Improved names handing, added a few tests