Refactor use_shorthand function