Merge pull request #113 from flexiblepower/development_bjorn

fixes #62 and #109
Merge pull request #114 from flexiblepower/development_bjorn

Pull request accepted.Looks good.
Small refactor
porting peakshaver to new PM codebase