restructure public api, fix file copies, add test