added Mahony algo