Clean-up, Merge 7.x-1.x, Fixing tests

Lots of clean-up, most tests are passing again, merged the commits from 7.x-1.x.

The dialog UI is work in progress. It's loading now but it's missing theming (it's partially see-through) and the clicking is not working, but that's already the case in the current version.
Woah, instant-review ;)

Copied, copied this stuff over and only changed it minimally.. the problem with #theme is that I will have to somehow change $options and prefix everything with #, was too lazy for that...