Added a first version of average consumption calculation
Fix #11

Also refactored the way we calculate the average consumption, to be more functional style.