extracted some common functions from org-input