updated to work distributed