Changed: General code clean-up and refactoring.