new endpoints code, interaction between list and map, code cleaned