Added if checks on sockets and quit app button