implements and closes #31