Refactor to struct