minor modification from EPFL