rewrote to make ideas clearer