Refactor with object oriented design