Caret refactor - DO NOT MERGE YET

Feel free to make comments etc.

I will try to get the rest of the tests written today.