Cleanup some algorithms so they work faster
Use ConcurrentMap in API