Refactor Ajax as module