Cleanup and compatible with Yosemite