Working Spatial Hash and more efficient

spatial hash works and added extra optimizations