Fix loading rules and add sleep in main loop