Reduced code to use new function