improved applescript