implementing more efficient energy evalutation