modified the class so that it is immutable