refactored getArea method