Added main method and disconnect pseudo code