Major changes

Code has been rewritten to improve the tidy data functionality.

Also the logic that extracted the -mean() and -std() columns was
rewritten as the original code got this wrong.