implements and closes #706