Library cleanup; improved documentation