Added log of trials and success rate, changed movement detection algorithm , other minimal changes.