large code refactor and tidy up

colour scheme now working correctly.
Just need swatches and Type to work.