Building functional cities