New rebased code from #15

svn -> git transition