Refactor testé, TODO : refactor js