Port some cleaner bat code form the Air.