Review of memory management and concurrency

Signed-off-by: Miguel M. Almeida <miguelcma@gmail.com>