Fixed problems with size of memory allocations
Changed Shared memory and other things