Added parameter for setting main loop frequency, and changed it to 50 Hz.