refactor endpoints to use self and