Initial version of analysis script.

This is a standalone version for debugging purposes. Some functions
contained in this file should be moved to a separate file later on.
Fixed empty item in column names.