Added wrapAround parameter to SP 

Fixes #1211
Fixes #1216

@chetan51 please review
I see, that sounds reasonable. 
But it's an important change, should be mentioned in the PR (if it's not a separate commit, which is pity but nevermind).