Refactor to work more type oriented.