Simplified somewhat.
Added some unit name manipulation.