improve oop code