code refactorings

Hi Andy, 
I know its a pain, but tried to commit direct to eaterprises master, but got a 403.