various library changes and cleanup