First commit on this, its incorrect because of an assumpiton I didn't notice.
Adding some commenting over a code review here