conditional checks added to library functions