initial code checkin

TODO: finish tests
WARN: not ready for use