Use a cleaner approach to combine libraries. Fixes #1