Updated function decleration gotchas

Use a named function instead of an anonymous function to simplify
debugging.
Merge pull request #9 from b52/functions

Updated function decleration gotchas