better performance - still refactoring

Change-Id: Ia568eff260e67565814675be908a0211d549572a
Signed-off-by: Marcelo Portilho <marceloport@gmail.com>