Move things around

@mdo have a look and let me know if there is an issue.

Compiled and tested locally seemed to worked fine.