added code from #73 + integrated pull request #79