refactor internal methods