Various computation time and memory occupation improvements.