Rewritten s3 module to allow for additional modes of operation.
Merge pull request #3440 from lwade/s3mode

Rewritten s3 module to allow for additional modes of operation.