Adding logging and fixing interval code.