implementing issue 28 (almost done)