Refactoring some helper methods.