indxjs refactor