Moved some methods into a helper class