Fix bugs in Primo service.
Merge remote-tracking branch 'origin/issue-4-primo-refactor' into bootstrap