updated to use OO programming

no more if statements