trackback with indmin and unshift!

slightly cleaner code