reused code part converted into shortcut function.