merge two private methods into one