refactor register API