Some refactoring to move code from tests to controllers. Using double in all math operations now.