Improve get location function. 

Signed-off-by: PedroLourenco <pdrolourenco@gmail.com>