adding button detection
merging with button implementation