Fixed the bug
Refactored to remove unnecessary instance variable