@SuppressWarnings("unchecked")
	@Override
	public void refreshView(Map<String, Map<String, Object>> state) {
		// Extract the maps from the state
		//
		Map<String, Object> mapState = state.get("mapState"), dayState = state
				.get("dayState");

		LinkedList<Map<String, Object>> elementList = (LinkedList<Map<String, Object>>) mapState
				.get("elements");
		
		Map<String, Integer> count = new HashMap<String, Integer>();
		Iterator<Map<String, Object>> elementIterator = elementList.iterator();
		Map<String, Object> element;
		
		Integer x = (Integer) mapState.get("x"), y = (Integer) mapState
				.get("y");
		
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				element = elementIterator.next();

				if (element != null) {
					if(count.get(element.get("type")) == null){
						count.put((String)element.get("type"), 0);
					}
					if(element.get("state") != "Dead"){
						count.put((String)element.get("type"), count.get(element.get("type"))+1);
					}
				}
			}
		}
		
		graph.update((int)(dayState == null ? 0 : dayState.get("day")), count);
		

		c.processViewCommand(Command.NEXTDAY);
	}