Change implementation of extend() to work before bind() is called.
Fixing some formatting.