added code to take each picture