Controller structure

Did a fix in the branch that really should be in the master too.