Moved code with global functions to helper class, closes #743