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.
We should be using #theme instead yeah?