Optimised buildMap

Now uses numpy array operations instead of iterating over elements. Profiling shows runtime on my machine dropped from 7.045s to 0.017s (!!)