Changed some inclusions, memory allocations and log