Moved utility function definition to top.

I find it's much easier to keep track of what's going on when utility functions like `objSome` are defined at the top, rather than the bottom.