Changed code to run on server.