Wrote most of the method