General code restructure

13/06/14