changed stopping condition to pressing home button. and improved loggin