Code trouble, Freq gen

Hey guys this is probly an easy fix, this was working at one point, great actually. So please if you can help me fix this code, not remake it all please lol.

So this is just a simple freq gen controlled my the serial monitor, I type-> F300 will do 300hz, I have it set to always stay at 50% duty. My problem is I cant go lower then 122hz? I have it set to change the prescaler from BV(CS10) to BV(CS12) when bellow 123hz. On my scope the pin just goes high when I go bellow 123hz, I would like this to go to 900khz like it does now, but go down to 2-5hz.

Can anyone see what im doing wrong here?

float Volts = 0;
int Time = 0;
int serialdata = 0;
int inbyte;
unsigned long duty =161;// 33500=50% duty
unsigned long freq = 25000;
float Num;
float Num2;
float freq1;


#include "NanoPWMac.h"


void setup() {
  Serial.begin(9600);
 Serial.println("Frequency Generator");
 Serial.println("Freq = 200 ");
 Serial.println("Duty Cycle = 50%");
 NanoPWMac(freq,duty);

}

void loop() {
 
  
  delay(1000); // Wait a second.

  if (inbyte != '/' || 'i' || 's' || 'd' || 'm' || 'S' || '<' || '>' || 'F' || 'D')
  {
    inbyte = Serial.read();
  
  
    if (inbyte > 0 && inbyte != '/')
    { 
      serialdata = serialdata * 10 + inbyte - '0';
      
  }  }
  //enter S then time
if(inbyte == 'F'){
  Num = Serial.parseFloat();
  freq = Num;
  freq1 = freq;
  float top = F_CPU / freq1 / 2 + 1;
  duty = (top+2)/2;
  Serial.print("Duty--->    ");
  Serial.println(duty);
  Serial.print("Freq Changed--->    ");
  Serial.println(freq);
  NanoPWMac(freq,duty);
  Serial.println("SERIAL.CLEARED");
  serialdata = 0;
  inbyte = 0;
  }
  if(inbyte == 'D'){
  Num2 = Serial.parseFloat();
  duty = duty/50*Num2;
  Serial.println("Duty Cycle Changed--->");
  Serial.print(duty);
  NanoPWMac(freq,duty);
  Serial.println("SERIAL.CLEARED");
  serialdata = 0;
  inbyte = 0;
  }}

.CPP

// ---------------------------------------------------------------------------
// Based on toneAC by Tim Eckel - teckel@leethost.com
// Modified by Richard Morrow - http://www.rmcybernetics.com
// Copyright 2013 License: GNU GPL v3 http://www.gnu.org/licenses/gpl-3.0.html
//
// See "NanoPWMac.h" for purpose, syntax, version history, links, and more.
// ---------------------------------------------------------------------------

#include "NanoPWMac.h"

// TODO: Compensate for freqeuncy inaccuracy at high frequencies
// TODO: Rename pulseWidth etc for pulse width etc
// TODO: Recalibrate pulseWidth for duty in ns (e.g. 0.125)

void NanoPWMac(unsigned long frequency, unsigned long pulseWidth) {
  if (frequency == 0 || pulseWidth == 0) { NanoPWMac_off(); return; }   // If frequency or pulseWidth are 0, turn off output and return.
  
  PWMT1DREG |= _BV(PWMT1AMASK) | _BV(PWMT1BMASK); // Set timer 1 PWM pins to OUTPUT (because analogWrite does it too).

  uint8_t prescaler = _BV(CS10);                 // Try using prescaler 1 first.
  unsigned long top = F_CPU / frequency / 2 + 1; // Calculate the top.
  if (top > 65000) {                             // If not in the range for prescaler 1, use prescaler 256 (122 Hz and lower @ 16 MHz).
    prescaler = _BV(CS12);                       // Set the 256 prescaler bit.
    top = top / 256 - 1;                         // Calculate the top using prescaler 256.
  }

  unsigned int duty = pulseWidth; // divide by 125 because one unit of duty = 125ns

  ICR1   = top;                         // Set the top.
  if (TCNT1 > top) TCNT1 = top;         // Counter over the top, put within range.
  TCCR1B = _BV(WGM13)  | prescaler;     // Set PWM, phase and frequency corrected (top=ICR1) and prescaler.
  OCR1A  = OCR1B = duty;                // Set the duty cycle (pulseWidth).
  TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(COM1B0); // Inverted/non-inverted mode (AC).

}

void NanoPWMac_off() {
  TIMSK1 &= ~_BV(OCIE1A);     // Remove the timer interrupt.
  TCCR1B  = _BV(CS11);        // Default clock prescaler of 8.
  TCCR1A  = _BV(WGM10);       // Set to defaults so PWM can work like normal (PWM, phase corrected, 8bit).
  PWMT1PORT &= ~_BV(PWMT1AMASK); // Set timer 1 PWM pins to LOW.
  PWMT1PORT &= ~_BV(PWMT1BMASK); // Other timer 1 PWM pin also to LOW.
}

header file

// ---------------------------------------------------------------------------
// NanoPWMac Library - v1.0 - August 2013
//
// AUTHOR/LICENSE:
// Based on ToneAC created by Tim Eckel - teckel@leethost.com
// Modified by Richard Morrow - http://www.rmcybernetics.com/
// Copyright 2013 License: GNU GPL v3 http://www.gnu.org/licenses/gpl-3.0.html
//
// LINKS:
// toneAC Project home: http://code.google.com/p/arduino-tone-ac/
// RMCybernetics - http://www.rmcybernetics.com/
//
// DISCLAIMER:
// This software is furnished "as is", without technical support, and with no 
// warranty, express or implied, as to its usefulness for any purpose.
//
// PURPOSE:
// Precision pulse generation with 125ns resolution
// Frequency 1Hz to 2MHz
//
// USAGE:
// Just tell it what frequency and pulse width in ns you want.
// Output is on two pins for push/pull typle output
//
// CONNECTION:
//   Pins  9 & 10 - ATmega328, ATmega128, ATmega640, ATmega8, Uno, Leonardo, etc.
//   Pins 11 & 12 - ATmega2560/2561, ATmega1280/1281, Mega
//   Pins 12 & 13 - ATmega1284P, ATmega644
//   Pins 14 & 15 - Teensy 2.0
//   Pins 25 & 26 - Teensy++ 2.0
//
// SYNTAX:
//   NanoPWMac(frequency, pulseWidth) - Starts the output
//     Parameters:
//       * frequency  - outputs specified frequency indefinitely, turn off with NanoPWMac_off().
//       * pulseWidth     - Set a pulseWidth in ns (should be a multiple of 125ns)
//   NanoPWMac_off()  - Stop output (both pins go low)
//---------------------------------------------------------------------------

#ifndef NanoPWMac_h
  #define NanoPWMac_h

  #if defined(ARDUINO) && ARDUINO >= 100
    #include <Arduino.h>
  #else
    #include <WProgram.h>
  #endif
  
  #if defined (__AVR_ATmega32U4__) || defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
    #define PWMT1AMASK DDB5
    #define PWMT1BMASK DDB6
    #define PWMT1DREG DDRB
    #define PWMT1PORT PORTB
  #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)
    #define PWMT1AMASK DDD4
    #define PWMT1BMASK DDD5
    #define PWMT1DREG DDRD
    #define PWMT1PORT PORTD
  #else
    #define PWMT1AMASK DDB1
    #define PWMT1BMASK DDB2
    #define PWMT1DREG DDRB
    #define PWMT1PORT PORTB
  #endif

  #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__)
    #define TIMSK1 TIMSK
  #endif

  
  void NanoPWMac(unsigned long frequency = 0, unsigned long pulseWidth = 125);
  void NanoPWMac_off();
#endif

I did figure this out I ended up having two variables called top, one in my code and one in my CPP file, these where creating a conflict.