public Element handle(FreeColServer server, Player player,
                          Connection connection) {
        ServerPlayer serverPlayer = server.getPlayer(connection);

        Unit unit;
        try {
            unit = player.getFreeColGameObject(unitId, Unit.class);
        } catch (Exception e) {
            return DOMMessage.clientError(e.getMessage());
        }

        Tile tile = unit.getTile();
        if (tile == null) {
            return DOMMessage.clientError("Unit is not on the map: " + unitId);
        } else if (!unit.hasAbility("model.ability.improveTerrain")) {
            return DOMMessage.clientError("Unit can not improve tiles: "
                + unitId);
        }

        TileImprovementType type = server.getSpecification()
            .getTileImprovementType(improvementId);
        TileImprovement improvement;
        if (type == null) {
            return DOMMessage.clientError("Not a tile improvement type: "
                + improvementId);
        } else if (type.isNatural()) {
            return DOMMessage.clientError("ImprovementType must not be natural: "
                + improvementId);
        } else if (!type.isTileTypeAllowed(tile.getType())) {
            return DOMMessage.clientError("ImprovementType not allowed on tile: "
                + improvementId);
        } else if ((improvement = tile.findTileImprovementType(type)) == null) {
            // TODO: This does not check if the tile (not TileType
            // accepts the improvement).
            if (!type.isWorkerAllowed(unit)) {
                return DOMMessage.clientError("Unit can not create improvement: "
                    + improvementId);
            }
        } else { // Has improvement, check if worker can contribute to it
            if (!improvement.isWorkerAllowed(unit)) {
                return DOMMessage.clientError("Unit can not work on improvement: "
                    + improvementId);
            }
        }

        // Proceed to change.
        return server.getInGameController()
            .changeWorkImprovementType(serverPlayer, unit, type);
    }