oop improve with exceptions