Added logging to a file, optimized intervals, added power calculation