refactor to object