refactored the function wrappers