implements and closes #242