added applescript with tweaks