added spatial statistics code
worked on code some more