Fix heap size calculation
Delay logfile clearing until after arrival at energy station