added find_beam function