finish hand-coding code, make code and filenames more readable.
normalise fields, fix reshape2 bug