clean and comment simulation code in server.R