Revised code for clarity. Added documentation.

Revised code for clarity, converting sample-rate to msec or Heart Rate
for all values before mean, variance and standard deviation are
calculated.
Added documentation and regrouped some variable declarations.
Added documentation.
Merge branch 'master' of https://github.com/CardioVascular-Research-Group/WaveformChesnokov