Fixes #191
Performance improvement