Major bug correction.
Major bug correction and memory usage decrease.