implemented #22

further testing needed before marking as resolved.