cleaned up code and changed input type to frequency/min