Added wrapAround parameter to SP 

Fixes #1211
Fixes #1216

@chetan51 please review
why is the formula changed?