swap() doesn't reflect $quantity when provided

As best as I can tell $quantity is never assigned, only checked on Line 136.
Revision to matching Taylor's coding style
Merge pull request #50 from gstjohn/patch-1

swap() doesn't reflect $quantity when provided