Code clean-up: removed debug code, added comments and documentation,
changed naming scheme to that used by the current PLM