refactoring to accommodate function checks