Fixes from andyli and improvements...