Fix calculation. Create pretty math javadoc.