first draft implementation, no tests.