made some progress, now have basic functionality as a library