Organized code in Repository handlers, cleaned hooks