Fixed main stuff, organised better