On giving a second thought, I think I was doing wrong. If users can specify their own midnight, then I dont think refreshing manually at 00:00 is right. Refresh should happen at only one time i.e at user specified midnight. If users does not specify anything then, refresh will happen at 00:00. Fixed it in latest commit.