new method to handle main form