refactoring to extract method/protocol as independent classes and renamed path to endpoint