Separate main and spot library functions
Merge pull request #1 from Ced/spot

Separate main and spot library functions