iphone script optimization?