Improve performance

Signed-off-by: Eduardo L. Buratti <elb09@c3sl.ufpr.br>
Improve performance
Improve performance
Refactor