Added methods to cpp

And improved bg.max
Merge branch 'master' of https://github.com/michbur/chipPCR