Refactored libraries controller