consolidate more code