works to spec - still needs a bit of final cleanup and docs