Add unit tests for some functions

97% of code coverage, some lines of code needs to be removed to increase coverage
Merge branch 'master' of github.com:rodo/bear

squash all commits on same file