merging PR #22 and #23 to master