Different version of 1 with help from James in the implementation.