Merged some similar functions.
Merged some similar functions.