sort by target functionality

Signed-off-by: Victor Gonzalez <victor.gonzalezro@gmail.com>