implemented base version of #42