first iteration working srvd code