Add constants and methods from 3.0.1 and 3.0.4 as well.
Basic algorithms.
Slight re-formatting