adjusting the code to run on server