Adding last changes to get an stable version, but not so good in resources handling. We need to investigate this and improve it a lot