Refactoring. Made all classes immutable