implements and closes #704