Nested hash function split into recursive and iterative solutions using #deep_merge
complete controller, params, router, and flash