Cleaned up the AppleScript