[Issue #39] Improved efficiency. Previous patch was good for highlighting the problem, but this one is the most effecient way to fix the issue