Refactored to inject helper

- And added unit test
Removed redundant methods
Fixed escaping
Rebased and tidied up
Fixed CS
Merge pull request #83 from dantleech/inject_helper

Refactored to inject helper