rewrote and rearranged everything