Refactor - renaming and fixing endpoint problem