public static void updatePreMainUpdate(){
        GameState state = DDGameLoop.getInstance().getGameState();
        ArrayList<DataContainer> dataCon;
        ArrayList<PlatformEvent> eventQueue;
        
        //Process PlatformEvents
        if(handler.getEventQueueSize()>0){
            eventQueue = handler.getPlatformEvents();
            
            for(PlatformEvent pe: eventQueue){
                processEvent(pe);
            }
            
            eventQueue = null;
        }
        
        //Process messages
        if(handler.getMsgCount()>0){
        	long now = System.currentTimeMillis();
        	if(true){
        		double diff = (now-lastMessageTime)/1000;
        		System.out.println("seconds since last processing: "+diff);
        		System.out.println("processing "+handler.getMsgCount()+" messages");
    		}
        	
        	lastMessageTime = now;
            dataCon = handler.getMessages();
            
            for(DataContainer dc: dataCon){
                processMessage(state, dc.getData(), dc.getPeerGID());
            }
            
            dataCon = null;
        }
        
        //Push update events every 250ms
        long updateDelta = System.currentTimeMillis()-lastUpdate;
        if(state==GameState.PLAYING&&updateDelta>250){
        	Connection.validate();
            OutputEvent shipUpdateEvent = new OutputEvent(null, OutputEventType.SHIP_UPDATE);
            outputQueue.add(shipUpdateEvent);
            lastUpdate = System.currentTimeMillis();
        }
    }