Cleaned up and fixed warnings.
Started to write up control maths.