Best episode of the series so far, although it still had a terrible ending, magic unexplained reset buttons don't become any less of a deus ex machina just because The Doctor threw it back through time.
Edit: Having looked on Digital Spy I realise now that the magic button was actually just a control for the magnet grab which means it isn't a deus ex machina, it is still an annoying 'reset' button though, which is become far too overused, everytime a character dies I instantly assume he'll come back thanks to a reset button now, I miss the days of Eccleston where he'd celebrate when everyone lived and would just assume someone would die on the way.