Refactored using instance and local variables only