modified to support ios, finished iOS demo