refactor to struct