Moved with-port-locking from C to Scheme
Rewrote format in Scheme