added code and tests into repo