updated with tylors code