Tests and logging

* Added unit tests and fixtures.
* Added logging.
* Save trig functions to names to flip them easily.