Improved home button logic