Refactor libraries