Changed unit handling code to allow lowercase units.