Fixed "short 8th beam"-bug. Simplified beam algorithm code.