New frequency algorithm