refactor programme to remove unnessecary instance variables