Fixed issues with library names being truncated

Wrote a clean_library_name function to properly apply name cleanup. Fixes #1