move code from find_orientations to coreutil