added energy distribution analysis and some fixes