improving connect button behavior & optimizing