Use Sinatra::Namespace.

and move helper function.