Improved frequency detection