added connect and grab function to mainform