updated to work with server