updated server code and cross-validation