working on distributed code (incomplete)