added some features from #3