Refactor to classes/objects