Formatting first state.
Merged with hmg's changes.
Corrected calculation of p-values, adjusted docs, finished formatting.