added memory maps and improved vectorization