updated the code. to run more frequently and respond to the ipad command