removed memory leakage, and added support for more frequencies as command line arguments