Update to use single function instead of a constructor