Refining code with better functions.