refactored notes controller