The code isn't quite close enough to make into a function. Two of the calls are the same (set_style), one uses a custom path (adm). I couldn't find any code that does something like this, so if we just want to clean this up, I'd suggest creating a function such as this: http://pastebin.com/67A2gnL1

Thoughts?