Refactored, function hoisting.