Refactored simple function out of code.