Extra code I got from nodeschool/discussions