Added most of the work