partial merge with #7 PR