Modification Work in progress. Some refactoring and polishing