Separate main and spot library functions