Finished first draft of mathematics + implementation.