Finally, working energy counter. :D