fixed oop bug (repeated code)