Addressed issue #22 with substantial improvement in speed.