Fixed bugs. Modified so that the interval duration is loaded from config file