#45 with requested changes based on #26