code snippets from my blog @ benfrederickson.com