Added connect menu, cleaned up the code