Overall fixes, getting ready for library export