Added custom lock function. Solved performance problem by using a much better point hash function (poor performance wasn't a result of locking). Closes #371.